from multiprocessing import Process


# 启动一个子进程
class MyProcess(Process):
    def __init__(self, name, fun, *args, **kwargs):
        super(MyProcess, self).__init__()
        self.name = name
        self.fun = fun
        self.args = args
        self.kwargs = kwargs

    def run(self):
        print("启动子进程服务", self.name)
        self.fun(*self.args, **self.kwargs)
